﻿using System;

namespace YourLastOptionsDialog.Core.Attributes
{
    /// <summary>
    /// An option attribute that represents an integral option (<see cref="byte"/>, <see cref="sbyte"/>, <see cref="short"/>, <see cref="ushort"/>,
    /// <see cref="int"/>, <see cref="uint"/>, <see cref="long"/>, <see cref="ulong"/>).
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public sealed class OptionIntegralAttribute : OptionAttribute
    {
        private long _minimum = long.MinValue;

        private long _maximum = long.MaxValue;

        /// <summary>
        /// Gets or sets the minimum allowed value for this option.
        /// The default is <see cref="long.MinValue"/>.
        /// </summary>
        public long Minimum
        {
            get
            {
                return _minimum;
            }

            set
            {
                _minimum = value;
            }
        }

        /// <summary>
        /// Gets or sets the maximum allowed value for this option.
        /// The default is <see cref="long.MaxValue"/>.
        /// </summary>
        public long Maximum
        {
            get
            {
                return _maximum;
            }

            set
            {
                _maximum = value;
            }
        }

        /// <summary>
        /// Gets or sets the validation error message that is used if the value is outside the configured 
        /// minimum or maximum bounds, or if the user enters a string that cannot be converted to an integral value.
        /// </summary>
        public string ValidationErrorMessage
        {
            get;
            set;
        }
    }
}